home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEV / A-B / 005.HierMenus.cpt / HierMenus.r < prev    next >
Text File  |  1988-08-01  |  4KB  |  140 lines

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    Hierarchical Menu Example Application
  6. #
  7. #    HierMenus
  8. #
  9. #    HierMenus.r    -    Rez Source
  10. #
  11. #    Copyright © 1988 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:    1.0                    8/88
  15. #
  16. #    Components:    HierMenus.p            August 1, 1988
  17. #                HierMenus.r            August 1, 1988
  18. #                HierMenus.make        August 1, 1988
  19. #
  20. #    This  program is a simple example of how to use hierarchical menus
  21. #    in your application.
  22. #
  23. #    See Sample and TESample for the general structure and MultiFinder
  24. #    techniques that we recommend that you use when building a new application.
  25. #
  26. ------------------------------------------------------------------------------*/
  27. /*
  28.  * HierMenus Menu Example - Resources
  29.  * Bryan Stearns 05May87 
  30.  */
  31.  
  32. #include "Types.r"
  33.  
  34. /* These define's are handy for disabling specific items in MENUs */
  35. #define AllItems    0b1111111111111111111111111111111    /* 31 flags */
  36. #define MenuItem1    0b000000001
  37. #define MenuItem2    0b000000010
  38. #define MenuItem3    0b000000100
  39. #define MenuItem4    0b000001000
  40. #define MenuItem5    0b000010000
  41. #define MenuItem6    0b000100000
  42. #define MenuItem7    0b001000000
  43. #define MenuItem8    0b010000000
  44. #define MenuItem9    0b100000000
  45.  
  46.  
  47. /* The File menu (it goes in the menu bar) */
  48. resource 'MENU' (128,"amenu") {
  49.     128, textMenuProc,
  50.     AllItems & ~ MenuItem4, /* all on except the ---- */
  51.     enabled, "A Menu",
  52.     {
  53.         "Font",        noicon, "\$1B", "\0D129", plain; /* "\$1B" means "hierarchical"; */
  54.         "Style",    noicon, "\$1B", "\0D130", plain; /* "\0Dxxx" is the menu ID of the submenu. */
  55.         "Size",        noicon, "\$1B", "\0D131", plain;
  56.         "-",            noicon, nokey, nomark, plain;
  57.         "Quit",        noicon, "Q", noMark, plain
  58.     }
  59. };
  60.  
  61. /* the Font submenu */
  62. resource 'MENU' (129,"Font",preload) {
  63.     129, textMenuProc,
  64.     AllItems,
  65.     enabled, "Font",
  66.     {
  67.         /* font names will be inserted with AddResMenu at runtime */
  68.     }
  69. };
  70.  
  71. /* the Style submenu */
  72. resource 'MENU' (130,"Style",preload) {
  73.     130, textMenuProc,
  74.     AllItems,
  75.     enabled, "Style",
  76.     {
  77.         "Plain",                    noicon, "P", noMark, plain;
  78.         "Bold",                        noicon, "B", noMark, $01;
  79.         "Italic",                    noicon, "I", noMark, $02;
  80.         "Underline",            noicon, "U", noMark, $04;
  81.         "Outline",                noicon, noKey, noMark, $08;
  82.         "Shadow",                    noicon, noKey, noMark, $10
  83.     }
  84. };
  85.  
  86. /* the Size submenu */
  87. resource 'MENU' (131,"Size",preload) {
  88.     131, textMenuProc,
  89.     AllItems,
  90.     enabled, "Size",
  91.     {
  92.         "9",                            noicon, noKey, noMark, plain;
  93.         "10",                            noicon, noKey, noMark, plain;
  94.         "12",                            noicon, noKey, noMark, plain;
  95.         "14",                            noicon, noKey, noMark, plain;
  96.         "18",                            noicon, noKey, noMark, plain;
  97.         "24",                            noicon, noKey, noMark, plain
  98.     }
  99. };
  100.  
  101.  
  102. /* Our window */
  103. resource 'WIND' (128) {
  104.     {50, 50, 280, 462}, documentProc, visible, noGoAway, 0, "Hierarchical Menus Test"
  105. };
  106.  
  107. /* Strings to draw */
  108. resource 'STR#' (128) {
  109.     {
  110.         "Hierarchical Menu Example";
  111.         "Apple Developer Technical Support";
  112.         "(BJS) 07May87";
  113.         "Try the menus!"
  114.     }
  115. };
  116.  
  117. /* The “I need System 4.1 etc.” alert */
  118. resource 'ALRT' (128) {
  119.     {50, 50, 180, 370}, 128, {
  120.         OK, visible, sound1;
  121.         OK, visible, sound1;
  122.         OK, visible, sound1;
  123.         OK, visible, sound1
  124.     }
  125. };
  126.  
  127. /* The item list for our “I need System 4.1 etc.” alert */
  128. resource 'DITL' (128) {
  129.     {    
  130.         /* the “OK” button */
  131.         {100, 220, 120, 300}, Button { enabled, "Finder" },
  132.         
  133.         /* The message */
  134.         {10, 65, 90, 300}, StaticText { disabled,
  135.             "The Hierarchical Menu Example requires a Macintosh II, SE, Plus, or "
  136.             "512Ke personal computer, with system software version 4.1 or newer."
  137.         }
  138.     }
  139. };
  140.